import time
import requests
import re
import numpy as np
import pandas as pd
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Firefox(executable_path=r'D:\bianchengerbianchenger\driver\geckodriver.exe')
driver.get('https://www.zhaopin.com/')
driver.maximize_window()
matix = np.zeros((10000,13))
def get_message_of(content_you_search,page):
    # 登陆
    driver.find_element(By.XPATH, '//*[@id="zpPassportWidget"]/div/div/div/div/div[1]/div/div').click()
    # 搜索
    driver.find_element(By.CLASS_NAME, 'a-input__native').send_keys(content_you_search)
    driver.find_element(By.XPATH, '//*[@id="rightNav_top"]/div/div[2]/div/div/div[2]/button').click()
    # 操作第二个界面
    cls = driver.window_handles
    driver.switch_to.window(cls[1])
    final_job_name = list()
    for i in range(page):
        time.sleep(3)
        all_div = driver.find_element()
        for i in all_div:
            job_name = i.find_element().text

            final_job_name.append(job_name)

            matrix=np.vstack((final_job_name))
        time.sleep(3)
        ck = driver.find_element()
        driver.execute_script("arguments[0].click();", ck)
    return matrix
list1 = get_message_of('软件测试',2)
print(list1)
print(type(list1))
list2 = pd.DataFrame(list1)
print(list2)
list3 = pd.DataFrame(list2.values.T)
list3.to_csv('data.csv')

